package com.atguigu.srb.sms.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
@Data
@ConfigurationProperties(prefix = "aliyun.sms")
public class SmsProperties {
    String host;
    String path;
    String method;
    String appcode;
    String tplId;

    //在当前类对象初始化后 使用类的静态属性接收成员属性值
    public static String HOST;
    public static String PATH;
    public static String METHOD;
    public static String APPCODE;
    public static String TPLID;

    @PostConstruct
    public void init(){
        SmsProperties.HOST = this.host;
        SmsProperties.PATH = this.path;
        SmsProperties.METHOD = this.method;
        SmsProperties.APPCODE = this.appcode;
        SmsProperties.TPLID = this.tplId;
    }
}
